package com.design.pattern.strategy.entity;

import com.design.pattern.strategy.behavior.FlyWithWings;
import com.design.pattern.strategy.behavior.QuackWithGuaGua;

/**
 * @author wangyingjie
 * @date 2018年10月12日14:26:48
 * @remark 绿头鸭
 */
public class MallarDuck extends Duck{

    public MallarDuck(){
        this.quackBehavior = new QuackWithGuaGua();
        this.flyBehavior = new FlyWithWings();
    }

    @Override
    public void display() {
        System.out.println("我是绿头鸭");
    }

    public static void main(String[] args) {
        MallarDuck mallarDuck = new MallarDuck();
        //行为的调用实际是调用父类的装饰方法，而具体方法实现在具体的行为实现类的方法中
        mallarDuck.performQuack();
        mallarDuck.performFly();
    }
}
